#ifndef FASTSTRING_H_
#define FASTSTRING_H_

#include"ifaststring.h"
#include"ipersist.h"
#include"iextensible.h"

class FastString:public IFastString,public IPersistentObject,public IExtensibleObject
{
    const int m_ch;
    char* m_psz;
    //newly added reference counting
    int m_cPtrs;
public:
    FastString(const char* sz);
    ~FastString();
    void Delete();
    int Length() const;
    int Find(const char* sz) const;

    //IpersistentObject methods
    bool Load(const char* pFileName);
    bool Save(const char* pFileName);

    //newly added
    void *Dynamic_Cast(const char* type);

    //reference counting
    void DuplicatePointer(){ m_cPters++;}
    void DestroyPointer() { int i=m_cPtrs; (--i==0)? (delete this) : (m_cPtrs=i); }
};

#endif
